export interface LoginData {
  username: string;
  password: string;
}

export function login(data: LoginData): Promise<R<Token>> {
  return useAPI("/security/login", {
    method: "POST",
    body: data,
  });
}

export function logout(): Promise<R<number>> {
  return useAPI("/security/logout", {
    method: "POST",
  });
}

export function refresh(refreshToken: string): Promise<R<Token>> {
  return useAPI("/security/refresh", {
    method: "POST",
    body: refreshToken,
  });
}
